Get Video Clip List
Description
The get_video_clip_list
function retrieves a list of video clips based on the provided parameters, including device ID, time range, and optional filters like count, order, and video clip type ID.
Function Signature:
def get_video_clip_list(ws_config: WebServiceConfig, device_id: int, start_epoch: int, end_epoch: int, count: int = 0, order: str = 'desc', video_clip_type_id = 1) -> WebServiceResult:
Parameters
- ws_config (WebServiceConfig): Configuration object for the web service.
- device_id (int): The ID of the device whose video clips are being retrieved.
- start_epoch (int): The starting epoch time (in seconds) for the time range.
- end_epoch (int): The ending epoch time (in seconds) for the time range.
- count (int, optional): The number of video clips to retrieve. Default is 0 (no limit).
- order (str, optional): The order of the results (either 'asc' for ascending or 'desc' for descending). Default is 'desc'.
- video_clip_type_id (int, optional): The type ID of the video clips to filter by. Default is 1.
Returns
- WebServiceResult: The result of the web service request, which includes:
- http_response_code: The HTTP response code from the server (e.g., 200 for success).
- http_response_string: The response body from the server, which may contain video clip data or errors.
- json_data: The parsed JSON response data, if available.
Example Usage
ws_config = WebServiceConfig(base_url="https://api.actionstreamer.com")
device_id = 1234
start_epoch = 1609459200 # Start of January 1, 2021
end_epoch = 1609545600 # End of January 1, 2021
result = get_video_clip_list(ws_config, device_id, start_epoch, end_epoch)
print(result.http_response_code, result.http_response_string)
Behavior
- Sends a
POST
request tov1/videoclip/list
to retrieve the video clips for the specified device and time range. - Optionally filters by count, order, and video clip type ID.
- Returns a
WebServiceResult
containing the response code, message, and parsed JSON data.
Error Handling
- General Exception: If any exception occurs during the request or processing, the function logs the error, sets the response code to
-1
, and includes a message in the response string indicating the failure.